import os

root_dir = "../dataset/train"
ants_label_dir = "ants"
bees_label_dir = "bees"

# 读取文件并生成对应的label.txt
img_path = os.listdir(os.path.join(root_dir, bees_label_dir))

out_dir = "bees_label"

label_path = os.path.join(root_dir, out_dir)

if not os.path.lexists(label_path):
    os.makedirs(label_path)

for i in img_path:
    file_name = i.split(".jpg")[0]
    with open(os.path.join(label_path, "{}.txt".format(file_name)) , 'w' )as f:
        f.write(bees_label_dir)
